"""
短信模版设置页面类
"""
from ..base_page import BasePage
from selenium.webdriver.common.by import By

class SetSendMessgeePage(BasePage):
    #数据
    url="/crm/index.php?m=sms&a=index"
    #定位器
    addmodel_locator = (By.CSS_SELECTOR, "#add")
    title_locator = (By.XPATH, "/html/body/div[7]/div[2]/form/table/tbody/tr[2]/td[2]/input")
    text_locator = (By.NAME, "content")
    btn_locator = (By.NAME, "submit")
    tips_success_locator=(By.XPATH,"/ html / body / div[5] / div[2]")
    delmodel_locator = (By.ID, "btn_delete")
    select_locator = (By.CSS_SELECTOR, "#form1 > div:nth-child(2) > table > tbody > tr:nth-child(1) > td:nth-child(1) > input")
    tips_del_success_locator=(By.XPATH,"/ html / body / div[5] / div[2]")

    #方法
    def addmodel(self):
        self.click(self.addmodel_locator)
    def title(self,title):
        self.send_keys(self.title_locator,title)
    def text(self,content):
        self.send_keys(self.text_locator,content)
    def btn_save(self):
        self.click(self.btn_locator)
    def tips_success(self):  #模版设置成功断言
        return self.find_element(self.tips_success_locator).text
    def delmodel(self):
        self.click(self.delmodel_locator)
    def select_model(self):
        self.click(self.select_locator)
    def tips_del_success(self):  #模版删除成功断言
        return self.find_element(self.tips_del_success_locator).text
